﻿<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title></title>
</head>
<body>
    <script charset="utf-8"></script>
    <script type="text/javascript">
        //with语句:定义with 语句的目的主要是为了简化多次编写同一个对象的工作

        function testWith() {
            //var qs = location.search.substring(1);
            //var hostName = location.hostname;
            //var url = location.href;

            with (location) {
                var qs = search.substring(1);
                var hostName = hostname;
                var url = href;
            }
        }
    </script>

</body>
</html>